package com.ningxia.water.configuration.quartz.job;

import com.ningxia.water.service.ITsMeterFlowService;
import com.ningxia.water.utils.LogUtils;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 设备电池电量不足   7小时一次  早上7点，下午14点 晚上21点
 * @author huangzhen
 * @create 2021-05-20 11:33
 */
@DisallowConcurrentExecution
@Component
public class BatteryPowerWarnJob implements Job {

    @Autowired
    private ITsMeterFlowService meterFlowService;

    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        LogUtils.getLogInstance().info("===============开始执行设备电池电量监测任务================");

        try {
            meterFlowService.monitorMeterInfos();
            LogUtils.getLogInstance().info("===============设备电池电量监测任务执行成功================");
        } catch (Exception e) {
            LogUtils.getLogInstance().error("===============设备电池电量监测任务执行失败================");
            e.printStackTrace();
        }
    }
}
